package com.ssy.lingxi.product.entity;

import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDate;

/**
 * 商品价格记录实体类
 * @author jw.chen
 * @version 2.0.0
 * @date 2021/10/19
 */
@Getter
@Setter
@Entity
@Table(schema = "public", name = "product_commodity_price_record",
        uniqueConstraints = {@UniqueConstraint(columnNames = {"commoditySkuId","date"})},
        indexes = {@Index(name = "product_commodity_price_record_commodity_id_idx", columnList = "commodityId"),
                @Index(name = "product_commodity_price_record_commodity_sku_id_idx", columnList = "commoditySkuId"),
                @Index(name = "product_commodity_price_record_date_idx", columnList = "date")})
public class CommodityPriceRecord implements Serializable {
    private static final long serialVersionUID = 6537483058106520611L;

    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="commodity_price_record_seq")
    @SequenceGenerator(sequenceName="product_commodity_price_record_seq", name="commodity_price_record_seq",allocationSize = 1)
    private Long id;

    /**
     * 商品id
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long commodityId;

    /**
     * 商品skuId
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long commoditySkuId;

    /**
     * 价格/积分
     */
    @Column(columnDefinition = "decimal", nullable = false)
    private Double price;

    /**
     * 日期时间
     */
    @Column(columnDefinition = "date", nullable = false)
    private LocalDate date;

}
